<?php

namespace App\Http\Controllers\Api\V1\Requests;

use App\Models\User;

class ApplyGoldWastesSubsidyRequest extends FormRequest
{
    public function rules(): array
    {
        /**
         * @var User $user
         */
        $user = $this->user();

        if ($user->myAllGoldWastesCount() <= 0) {
            fail('无可领取记录');
        }

        return [
            'pay_code' => $this->paycode(false)
        ];
    }

    public function attributes(): array
    {
        return ['pay_code' => '交易密码'];
    }
}
